//
// Created by 123 on 2025/1/8.
//
#include "set"
#include "iostream"
using namespace std;

void printSet(set<int>& s){
    for(set<int>::iterator it = s.begin();it!=s.end();it++){
        cout << *it << " ";
    }
    cout << endl;
}

void test(){
    set<int> s1;
    s1.insert(10);
    s1.insert(20);
    s1.insert(40);
    s1.insert(30);
    printSet(s1);

    set<int>s2(s1);
    printSet(s2);

    set<int>s3;
    s3 = s2;
    printSet(s3);

    if (s3.empty()){
        cout << "s3 is null" << endl;
    }else{
        cout << "s3 size =" << s3.size() << endl;
    }

    set<int> s4;
    s4.insert(2);
    s4.swap(s3);
    printSet(s4);
    printSet(s3);

    s4.erase(s4.begin());
    s4.erase(30);
    s4.clear();
    printSet(s4);
}

void test2(){
    set<int> s1;
    s1.insert(30);
    s1.insert(20);
    s1.insert(20);
    s1.insert(10);
    s1.insert(40);
    //查找
    set<int>::iterator pos = s1.find(30);
    if(pos != s1.end()){
        cout << "got it" << endl;
    }else{
        cout << "fuck" << endl;
    }
    int num = s1.count(30);
    cout << "num=" << num << endl;
}

int main137(){
    test();
    test2();
    return 0;
}